import { MenuItem } from '../../system/model/menuModel'

export interface LoginUserInfo {
  avatar?: string
  clientId: string
  id: string
  mail?: string
  name?: string
  phone: string
  pid: string
  username: string
}
export interface AccountInfo {
  user: LoginUserInfo
  token: string
  perms?: MenuItem[]
}

export interface CommonUserInfo
  extends Omit<LoginUserInfo, 'clientId' | 'pid'> {
  enabled: boolean
  loginCount: number
  loginTime: string
}

export interface LoginRequest {
  username: string
  password: string
  clientId: string
  secret: string
}

export interface GetAccountsReq {
  key?: string
  size: number
  current: number
}

export interface InsertAccountReq {
  name?: string
  username: string
  phone: string
  mail?: string
  avatar?: string
  /** 应用ID，目前默认是拍信管理后台 */
  clientId?: string
}

export interface ModifyAccountReq extends Partial<InsertAccountReq> {
  id: string
  enabled?: boolean
}

export interface ModifyAccountRoleReq {
  id: string
  roleIds: string[]
}

export interface ModifyAccountPassword {
  password: string
  newPassword: string
}
